﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PhotoSlider
{
    /// <summary>
    /// Contains photo slider options.
    /// </summary>
    public class Options
    {
        /// <summary>
        /// Parses options from command line arguments.
        /// May throw Exception
        /// </summary>
        /// <exception cref="Exception">Thrown in case of not enought arguments for a parameter.</exception>
        /// <exception cref="NotSupportedException">Thrown in case of not supported/unknown parameter</exception>
        /// <param name="args"></param>
        public void Load(string[] args)
        {
            RunOnAllScreens = false;
            MovePath = "_good";

            int i = 0;
            while (i < args.Length)
            {
                switch (args[i])
                {
                    case "as":
                        RunOnAllScreens = true;
                        break;
                    case "--movepath":
                        ++i;
                        if (args.Length <= i)
                            throw new Exception("Not enought arguments for --movepath");
                        MovePath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), args[i]);
                        break;
                    default:
                        throw new NotSupportedException("Unknown argument:" + args[i]);
                }
                ++i;
            }
        }

        public bool RunOnAllScreens { get; private set; }
        public string MovePath { get; private set; }
    }
}
